3.4.35 \(\int \frac {B \sec (c+d x)+C \sec ^2(c+d x)}{a+a \sec (c+d x)} \, dx\) [335]

Optimal. Leaf size=44 \[ \frac {C \tanh ^{-1}(\sin (c+d x))}{a d}+\frac {(B-C) \tan (c+d x)}{a d (1+\sec (c+d x))} \]

[Out]

C*arctanh(sin(d*x+c))/a/d+(B-C)*tan(d*x+c)/a/d/(1+sec(d*x+c))

________________________________________________________________________________________

Rubi [A]
time = 0.05, antiderivative size = 44, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 32, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.125, Rules used = {4135, 3855, 12, 3879} \begin {gather*} \frac {(B-C) \tan (c+d x)}{a d (\sec (c+d x)+1)}+\frac {C \tanh ^{-1}(\sin (c+d x))}{a d} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(B*Sec[c + d*x] + C*Sec[c + d*x]^2)/(a + a*Sec[c + d*x]),x]

[Out]

(C*ArcTanh[Sin[c + d*x]])/(a*d) + ((B - C)*Tan[c + d*x])/(a*d*(1 + Sec[c + d*x]))

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3879

Int[csc[(e_.) + (f_.)*(x_)]/(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Simp[-Cot[e + f*x]/(f*(b + a*
Csc[e + f*x])), x] /; FreeQ[{a, b, e, f}, x] && EqQ[a^2 - b^2, 0]

Rule 4135

Int[((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_.))/(csc[(e_.) + (f_.)*(x_)]*(b_.) +
 (a_)), x_Symbol] :> Dist[C/b, Int[Csc[e + f*x], x], x] + Dist[1/b, Int[(A*b + (b*B - a*C)*Csc[e + f*x])/(a +
b*Csc[e + f*x]), x], x] /; FreeQ[{a, b, e, f, A, B, C}, x]

Rubi steps

\begin {align*} \int \frac {B \sec (c+d x)+C \sec ^2(c+d x)}{a+a \sec (c+d x)} \, dx &=\frac {\int \frac {(a B-a C) \sec (c+d x)}{a+a \sec (c+d x)} \, dx}{a}+\frac {C \int \sec (c+d x) \, dx}{a}\\ &=\frac {C \tanh ^{-1}(\sin (c+d x))}{a d}+(B-C) \int \frac {\sec (c+d x)}{a+a \sec (c+d x)} \, dx\\ &=\frac {C \tanh ^{-1}(\sin (c+d x))}{a d}+\frac {(B-C) \tan (c+d x)}{d (a+a \sec (c+d x))}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(106\) vs. \(2(44)=88\).
time = 0.20, size = 106, normalized size = 2.41 \begin {gather*} \frac {2 \cos \left (\frac {1}{2} (c+d x)\right ) \left (C \cos \left (\frac {1}{2} (c+d x)\right ) \left (-\log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+\log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )+(B-C) \sin \left (\frac {1}{2} (c+d x)\right )\right )}{a d (1+\cos (c+d x))} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(B*Sec[c + d*x] + C*Sec[c + d*x]^2)/(a + a*Sec[c + d*x]),x]

[Out]

(2*Cos[(c + d*x)/2]*(C*Cos[(c + d*x)/2]*(-Log[Cos[(c + d*x)/2] - Sin[(c + d*x)/2]] + Log[Cos[(c + d*x)/2] + Si
n[(c + d*x)/2]]) + (B - C)*Sin[(c + d*x)/2]))/(a*d*(1 + Cos[c + d*x]))

________________________________________________________________________________________

Maple [A]
time = 0.47, size = 61, normalized size = 1.39

method result size
derivativedivides \(\frac {B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-C \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-C \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+C \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d a}\) \(61\)
default \(\frac {B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-C \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-C \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+C \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d a}\) \(61\)
risch \(\frac {2 i B}{d a \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}-\frac {2 i C}{d a \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) C}{a d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) C}{a d}\) \(91\)
norman \(\frac {\frac {\left (B -C \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a d}-\frac {\left (B -C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{a d}}{\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1}+\frac {C \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{a d}-\frac {C \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{a d}\) \(105\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((B*sec(d*x+c)+C*sec(d*x+c)^2)/(a+a*sec(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/d/a*(B*tan(1/2*d*x+1/2*c)-C*tan(1/2*d*x+1/2*c)-C*ln(tan(1/2*d*x+1/2*c)-1)+C*ln(tan(1/2*d*x+1/2*c)+1))

________________________________________________________________________________________

Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 99 vs. \(2 (44) = 88\).
time = 0.29, size = 99, normalized size = 2.25 \begin {gather*} \frac {C {\left (\frac {\log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a} - \frac {\log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a} - \frac {\sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}\right )} + \frac {B \sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((B*sec(d*x+c)+C*sec(d*x+c)^2)/(a+a*sec(d*x+c)),x, algorithm="maxima")

[Out]

(C*(log(sin(d*x + c)/(cos(d*x + c) + 1) + 1)/a - log(sin(d*x + c)/(cos(d*x + c) + 1) - 1)/a - sin(d*x + c)/(a*
(cos(d*x + c) + 1))) + B*sin(d*x + c)/(a*(cos(d*x + c) + 1)))/d

________________________________________________________________________________________

Fricas [A]
time = 4.75, size = 74, normalized size = 1.68 \begin {gather*} \frac {{\left (C \cos \left (d x + c\right ) + C\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (C \cos \left (d x + c\right ) + C\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (B - C\right )} \sin \left (d x + c\right )}{2 \, {\left (a d \cos \left (d x + c\right ) + a d\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((B*sec(d*x+c)+C*sec(d*x+c)^2)/(a+a*sec(d*x+c)),x, algorithm="fricas")

[Out]

1/2*((C*cos(d*x + c) + C)*log(sin(d*x + c) + 1) - (C*cos(d*x + c) + C)*log(-sin(d*x + c) + 1) + 2*(B - C)*sin(
d*x + c))/(a*d*cos(d*x + c) + a*d)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \frac {\int \frac {B \sec {\left (c + d x \right )}}{\sec {\left (c + d x \right )} + 1}\, dx + \int \frac {C \sec ^{2}{\left (c + d x \right )}}{\sec {\left (c + d x \right )} + 1}\, dx}{a} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((B*sec(d*x+c)+C*sec(d*x+c)**2)/(a+a*sec(d*x+c)),x)

[Out]

(Integral(B*sec(c + d*x)/(sec(c + d*x) + 1), x) + Integral(C*sec(c + d*x)**2/(sec(c + d*x) + 1), x))/a

________________________________________________________________________________________

Giac [A]
time = 0.49, size = 70, normalized size = 1.59 \begin {gather*} \frac {\frac {C \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{a} - \frac {C \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{a} + \frac {B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - C \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a}}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((B*sec(d*x+c)+C*sec(d*x+c)^2)/(a+a*sec(d*x+c)),x, algorithm="giac")

[Out]

(C*log(abs(tan(1/2*d*x + 1/2*c) + 1))/a - C*log(abs(tan(1/2*d*x + 1/2*c) - 1))/a + (B*tan(1/2*d*x + 1/2*c) - C
*tan(1/2*d*x + 1/2*c))/a)/d

________________________________________________________________________________________

Mupad [B]
time = 2.83, size = 41, normalized size = 0.93 \begin {gather*} \frac {2\,C\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{a\,d}+\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (B-C\right )}{a\,d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((B/cos(c + d*x) + C/cos(c + d*x)^2)/(a + a/cos(c + d*x)),x)

[Out]

(2*C*atanh(tan(c/2 + (d*x)/2)))/(a*d) + (tan(c/2 + (d*x)/2)*(B - C))/(a*d)

________________________________________________________________________________________